package com.clqteam.controller;

import java.io.IOException;
import java.io.PrintWriter;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.clqteam.service.UpdateSupplierService;
import com.clqteam.serviceimpl.UpdateSupplierServiceImpl;
/**
 * 供应商信息修改功能的controller
 * @author Administrator lxg
 *
 */

public class UpdateSupplierController extends HttpServlet{
	@Override
	protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
		doPost(req, resp);
	}
	
	@Override
	protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
		resp.setCharacterEncoding("utf8");

		req.setCharacterEncoding("utf8");


		UpdateSupplierService uss=new UpdateSupplierServiceImpl();
		//获取文本框的值
		String supid=req.getParameter("supId");
		int supId=Integer.parseInt(supid);
		String supName=req.getParameter("supName");
		String supContacts=req.getParameter("supContacts");
		String supPhone=req.getParameter("supPhone");
		String eid=req.getParameter("eId");
		int eId=Integer.parseInt(eid);
		
		boolean boo=uss.updateSupplierBySupId(supName, supContacts, supPhone, eId, supId);
		
		PrintWriter pw=resp.getWriter();
		if(boo=true){
			pw.write("1");
		}else{
			pw.write("0");
		}
		pw.flush();
		pw.close();
	}
}
